package com.tmt.im.jpa.repository;

import com.tmt.data.jpa.repository.ITmtBaseRepo;
import com.tmt.im.jpa.entity.IMFriendApply;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Repository;

import java.sql.Timestamp;
import java.util.List;

/**
 * @Description TODO
 * @Author wuyi
 * @Date 2024/7/13 19:03
 * @Version 1.0
 **/
@Repository
public interface IMFriendApplyRepo extends ITmtBaseRepo<IMFriendApply, Long> {

    IMFriendApply findOneByCreatorIdAndFriendId(Long creatorId, Long targetId);

    int countByReviewTimeIsNullAndFriendIdAndCreateTimeAfter(Long targetId, Timestamp expireTime);

    Page<IMFriendApply> findAllByReviewTimeIsNullAndFriendId(Long friendId, Pageable pageable);

    Page<IMFriendApply> findAllByReviewTimeIsNullAndCreatorId(Long creatorId, Pageable pageable);

    void deleteAllByIdIn(List<Long> ids);
}
